From: Sebastian Keller Date: Tue, 16 Feb 2021 12:37:17 +0000 (+0100) Subject: workspace: Ensure that _createBestLayout() always returns a layout X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~317 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c01973055f994bd6ce89e6790756be3ad5dafebc;p=gnome-shell.git workspace: Ensure that _createBestLayout() always returns a layout When opening a large number of windows, the computed space and scale for a layout can become negative due to the per-row/per-column spacing. This is smaller than the initial values of lastSpace and lastSpace, leading to a null return which then causes all sorts of other issues resulting in the workspace becoming invisible. This change ensures that the function always returns a layout, even if it may look a bit broken and does not conform to the scale/space requirements which are impossible to fulfill for the given number of windows. It's better than displaying nothing, since it allows users to move/close windows and restore this to a more usable state. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3730 Part-of: --- diff --git a/js/ui/workspace.js b/js/ui/workspace.js index f9f9e51ee..6bf5cfe26 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -518,7 +518,7 @@ var WorkspaceLayout = GObject.registerClass({ const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area); - if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space)) + if (lastLayout && !this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space)) break; lastLayout = layout;